#!/bin/sh
#
# mass convert to ogg
#

go() {
	for ext ; do
		find . -name "*.$ext" -exec sh -c \
			'ffmpeg -i "{}" -y -c:a \
			libopus -b:a 128k "${0%.*}.opus" && \
			rm "$0"' {} \;
	done
	printf "\nAll files have been converted to opus!\n"
}

go ogg aac flac mp3 wav m4a
